/*
 * @Author: weisheng
 * @Date: 2023-04-17 12:51:22
 * @LastEditTime: 2023-04-20 15:01:53
 * @LastEditors: weisheng
 * @Description:
 * @FilePath: \uniapp-vue3-fant-ts\src\api\DemoApi.ts
 * 记得注释
 */
import http from '@/http/HttpClient'
import BaseResponse from '@/model/BaseResponse'
import Chanel from '@/model/Chanel'
import UserInfo from '@/model/UserInfo'
import { getParams } from '@/utils/common'
// 这里将API方法统一管理
export default class DemoApi {
  /**
   * 登录
   */
  static login(data): Promise<BaseResponse<UserInfo>> {
    return http
      .server()
      .post('/cityAdmin/mall/open/v2/login_check', data, {})
      .then((res) => {
        return res.data
      })
  }
  static getMerchantType(data): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .get(`/dev/dict/subordinate/list${getParams(data)}`, {})
      .then((res) => {
        return res.data
      })
  }
  static getUserInfo(): Promise<BaseResponse<Chanel[]>> {
    return http
      .server()
      .get(`/cityAdmin/mall/main/get_user_info`, {})
      .then((res) => {
        return res.data
      })
  }
  static getStoreType() {
    return http
      .server()
      .get(`/cityAdmin/mall/goods/v2/type`, {})
      .then((res) => {
        return res.data
      })
  }
  static getStoreDataList(data) {
    return http
      .server()
      .get(`/cityAdmin/mall/goods/v2/list_data${getParams(data)}`, {})
      .then((res) => {
        return res.data
      })
  }
  static deleteShop(data) {
    return http
      .server()
      .get(`/cityAdmin/mall/goods/del${getParams(data)}`, {})
      .then((res) => {
        return res.data
      })
  }
  // 设置上架下架
  static setShelfRecommends(data): Promise<BaseResponse<UserInfo>> {
    return http
      .server()
      .post('/cityAdmin/mall/goods/shelf_recommends', data, {})
      .then((res) => {
        return res.data
      })
  }
  // 设置分销
  static setShelfDists(data): Promise<BaseResponse<UserInfo>> {
    return http
      .server()
      .post('/cityAdmin/mall/goods/shelf_dists', data, {})
      .then((res) => {
        return res.data
      })
  }
  // 设置分销
  static setDistsMoney(data): Promise<BaseResponse<UserInfo>> {
    return http
      .server()
      .post('/cityAdmin/mall/goods/dists_price', data, {})
      .then((res) => {
        return res.data
      })
  }
}
